<?php namespace Common\Model;

use Hdphp\Model\Model;

class TypeAttr extends Model{
	protected $table = "typeattr";

	protected $validate = array(
		array('aname','required','属性名称不能为空',3,3),
		array('value','required','属性值不能为空',3,3)
	);

	public function addData($tid,$addInfo){
		if($this->create()){
			$addInfo['type_tid'] = $tid;
			$this->add($addInfo);
			return true;
		}
		return false;
	}

	public function getInfo($tid){
		return $this->where("type_tid={$tid}")->get();
	}

	public function delData($aid){
		$this->where("aid={$aid}")->delete();
	}

	public function editData(){
		if($this->create()){
			$this->save();
			return true;
		}
		return false;
	}
}


 ?>